package com.yw.uglygeeker.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.yw.uglygeeker.pojo.SysDict;
import com.yw.uglygeeker.service.SysDictService;

@RestController
@RequestMapping(value="/api/v1")
public class TestController {

	@Autowired
	private SysDictService sysDictService;
	
	@RequestMapping(value="test",method=RequestMethod.GET)
	public String getTestValue(){
		return "aaaa";
	}
	
	@RequestMapping(value="dictList/{group}",method=RequestMethod.GET)
	public List<SysDict> getTestValue(@PathVariable(value="group") String group){
		return sysDictService.getListByGroup(group);
	}
	
	@RequestMapping(value="dictList",method=RequestMethod.GET)
	public List<SysDict> getDictValue2(@RequestParam(name="group",required=true) String group){
		return sysDictService.getListByGroup2(group);
	}
	
	@RequestMapping(value="dictList2/{group}",method=RequestMethod.GET)
	public List<SysDict> getTestValue3(@PathVariable(value="group") String group){
		return sysDictService.getListByGroup3(group);
	}
	
	
	@RequestMapping(value="dict/{id}",method=RequestMethod.GET)
	public ResponseEntity<SysDict> getDict(@PathVariable(value="id") Long id){
		return new ResponseEntity<SysDict>(sysDictService.getDict(id), HttpStatus.OK);
	}
}
